<?php
//测试控制器类
class IndexController extends CommonController{
	
	private $model;

	public function __auto() {
		$this -> model = K('Cate');
	}
	
	
	
    //动作方法
    public function index(){
//  	p($_SESSION);
		//获得顶级分类
		$cateData =$this -> model->where("pid=0")->all();
		$this->assign("cateData",$cateData);
//		p($cateData);

		//轮播左侧分类
		$cData =$this -> model->where("pid=0")->all();
		foreach ($cData as $k => $v) {
			$cData[$k]['son'] = $this -> model->where("pid={$v['cid']}")->all();
		}
//		p($cData);
		$this->assign('cData',$cData);
		
		
		//商品图片
		$shopData = K('Shop')->all();
//		p($shopData);
		$this->assign("shopData",$shopData);
        //显示视图
       $this->display();
    }
	
	
	
	
	
	
	
	
	
	
	
	
	
}